package data;

/**
 * 
 * @author Niels Schmidt Hansen Initiates Model class
 */
public class ModelClass {
	User currentUser;
	Account currentAccount;
	DbConnection dbConnection;

	public void setCurrentAccountWithType(String accountType) {
		for (Account account : dbConnection.getAccounts()) {
			if (account.getUserId().equals(currentUser.getCpr_number())
					&& account.getKontoType().equals(accountType)) {
				currentAccount = account;
			}
		}
	}

	public ModelClass() {
		dbConnection = new DbConnection();
	}

	/**
	 * Sets the current user so only the logged in user only can see his/shes
	 * accounts
	 * 
	 * @param user
	 */
	public void setCurrentUser(User user) {
		this.currentUser = user;
	}

	public void setCurrentAccount(Account account) {
		this.currentAccount = account;
	}

	public DbConnection getDbConnection() {
		return dbConnection;
	}

	public void setDbConnection(DbConnection dbConnection) {
		this.dbConnection = dbConnection;
	}

	public User getCurrentUser() {
		return currentUser;
	}

	public Account getCurrentAccount() {
		return currentAccount;
	}
}